﻿using System;

namespace Dapper.ExpressionExtension.SqlBuilders
{
    /// <summary>
    /// sql生成器
    /// </summary>
    public interface ISqlBuilder
    {
        /// <summary>
        /// 加前缀
        /// </summary>
        /// <param name="paramName"></param>
        /// <returns></returns>
        string PrefixParameter(string paramName);

        /// <summary>
        /// 生成插入的sql
        /// </summary>
        /// <param name="type">类型</param>
        /// <param name="tableName">表名</param>
        /// <param name="columnNames">列名</param>
        /// <param name="paramNames">参数</param>
        /// <returns></returns>
        string BuildInsert(Type type, string tableName, string[] columnNames, string[] paramNames);

        /// <summary>
        /// 生成分页查询的sql
        /// </summary>
        /// <param name="orderBy">排序</param>
        /// <param name="pageNumber">页码</param>
        /// <param name="pageSize">每页大小</param>
        /// <returns></returns>
        string BuildPaging(string orderBy, int pageNumber, int pageSize);

        /// <summary>
        /// 添加引用符号
        /// </summary>
        /// <param name="identifier"></param>
        /// <returns></returns>
        string QuoteIdentifier(string identifier);

        /// <summary>
        /// 数量限制
        /// </summary>
        /// <param name="count"></param>
        /// <returns></returns>
        string Limit(int count);
    }
}
